/**
 * Created by lgoodbook@163.com on 2017/8/16.
 */
var token = localStorage.getItem("token"); //全局用户token
if(token == 'null'){
    parent.location.href = baseURL;
}

var baseURL = "/"; //全局URL前缀

//jquery 全局设置
$.ajaxSetup({
    dataType: 'json',
    cache: 'false',
    headers: {
        'token': token
    },
    complete: function (event, xhr, options) {
        if (event.status == 401) {
            parent.location.href = baseURL ;
        }
    }
});

//重写alert
window.alert = function(msg, callback){
    parent.layer.alert(msg, function(index){
        parent.layer.close(index);
        if(typeof(callback) === "function"){
            callback("ok");
        }
    });
}